#!/usr/bin/ksh93 ################################################################ SSHUSER="s45x" HMCMACH="dallphmc01" for i in $( ssh ${SSHUSER}@${HMCMACH} lssyscfg -r sys -F name ); do SYS="${i//[!A-Za-z0-9]/}" print "Gathering Ethernet virtual I/O info for ${SYS}" ssh ${SSHUSER}@${HMCMACH} lshwres -r virtualio --rsubtype eth -m ${i} --level lpar > "/tmp/tmp${$}.out" sort -n < "/tmp/tmp${$}.out" > "${SYS}.virteth.out" rm -f "/tmp/tmp${$}.out" done COLOR=( white red green blue yellow cyan magenta lightred lightblue lightgreen ) ICNT="0" for FNAME in Server*.virteth.out do unset LPAR SYSNAME[ICNT]="${FNAME%%.*}" SYS="${SYSNAME[ICNT++]//[!A-Za-z0-9]/}" sed -e "s/\".*\"//g;s/=/=\"/g;s/,,*/\";/g;s/$/\"/g" "${FNAME}" | while read -r -- ATTRLINE do eval ${ATTRLINE} drc_index="${mac_addr}" eval unset ${SYS}_${drc_index} eval typeset -A ${SYS}_${drc_index} IFS=";" for i in ${ATTRLINE} do eval ${i} print "${SYS}_${drc_index}[${i%%=*}]=${i##*=}" eval eval ${SYS}_${drc_index}[\${i%%=*}]="\"\${i##*=}\"" done eval ${SYS}_index[SCNT++]="\"\${drc_index}\"" eval ${SYS}_${drc_index}[adapter_type]="\"server\"" (( is_trunk != 1 )) && eval ${SYS}_${drc_index}[adapter_type]="\"client\"" eval LPAR[LCNT++]="\"\${${SYS}_${drc_index}[lpar_name]}\"" if [[ "_${LPAR[LCNT-1]}" != "_" ]] then OUTFILE="${LPAR[LCNT-1]}.virtualeth.html" exec 4>"${OUTFILE}" print -u 4 "\n" print -u 4 "\n


" eval print -u 4 "\"\n

\${${SYS}_${drc_index}[lpar_name]}

\"" print -u 4 "\n

" exec 4>&- fi IFS=$' \t\n' done MCNT="0" eval typeset -A ${SYS}_LCOLOR eval ${SYS}_LCOLOR[NULL]="${COLOR[MCNT]}" for LNAME in "${LPAR[@]}" do print "${LNAME}" done | sort | uniq | while read -- MNAME do [[ "_${MNAME}" != "_" ]] && eval ${SYS}_LCOLOR[\${MNAME}]="\"\${COLOR[++MCNT]}\"" done done exec 3>virtualeth.content.shtml ICNT="0" for SYS in "${SYSNAME[@]}" do SYS="${SYS//[!A-Za-z0-9]/}" print "\n\n${SYS}" print -u 3 "\n" print -u 3 "\n


" print -u 3 "\n

${SYS}

" print -u 3 "\n

" eval INDEX="( \${${SYS}_index[@]} )" print "Drawer Serial,Bus,Slot,Adapter,LPAR" print -u 3 "

" print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 "

" for IDX in "${INDEX[@]}" do eval OUTPUT="\"\${${SYS}_${IDX}[adapter_type]}\",\ \"\${${SYS}_${IDX}[slot_num]}\",\ \"\${${SYS}_${IDX}[is_trunk]}\",\ \"\${${SYS}_${IDX}[port_vlan_id]}\",\ \"\${${SYS}_${IDX}[mac_addr]}\",\ \"\${${SYS}_${IDX}[lpar_name]}\"" # print "${OUTPUT}" eval BGCOLOR="\"\${${SYS}_LCOLOR[\${${SYS}_${IDX}[lpar_name]}]}\"" [[ "_${DESC}" = _[Ee]mpty* ]] && BGCOLOR="grey" [[ "_${BGCOLOR}" = "_" ]] && BGCOLOR="white" print -u 3 "

" print -u 3 "

" # print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " print -u 3 " " eval OUTFILE="\"\${${SYS}_${IDX}[lpar_name]}\"" if [[ "_${OUTFILE}" != "_" ]] then OUTFILE="${OUTFILE}.virtualeth.html" print -u 3 " " exec 4>>"${OUTFILE}" print -u 4 "

" print -u 4 "

" print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 " " print -u 4 "

" exec 4>&- else print -u 3 " " fi print -u 3 " " print -u 3 "

" done print -u 3 "
Adapter TypeSlotTrunk DevicePort Virtual LAN IDMAC AddressLPAR Name
" # eval print -u 3 "\"\${${SYS}_${IDX}[lpar_name]}\"" # print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[adapter_type]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[slot_num]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[is_trunk]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[port_vlan_id]}\"" print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[mac_addr]}\"" print -u 3 " " print -u 3 " " eval print -u 3 "\"\${${SYS}_${IDX}[lpar_name]}\"" print -u 3 " " print -u 3 "
" eval print -u 4 "\"\${${SYS}_${IDX}[adapter_type]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[slot_num]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[is_trunk]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[port_vlan_id]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[mac_addr]}\"" print -u 4 " " eval print -u 4 "\"\${${SYS}_${IDX}[lpar_name]}\"" print -u 4 "
" print -u 3 " " print -u 3 "

" done exec 3>&- # # End the HTML code for each LPAR file # for SYS in "${SYSNAME[@]}" do SYS="${SYS//[!A-Za-z0-9]/}" eval INDEX="( \${${SYS}_index[@]} )" for IDX in "${INDEX[@]}" do eval print "\"\${${SYS}_${IDX}[lpar_name]}\"" done > /tmp/${$}.out sort /tmp/${$}.out | uniq | while read -- MNAME do if [[ "_${MNAME}" != "_" ]] then OUTFILE="${MNAME}.virtualeth.html" exec 4>>"${OUTFILE}" print -u 4 "

" exec 4>&- fi done rm -f /tmp/${$}.out done